import Vue from 'vue'
// 自定义指令v-has
// /**权限指令**/
Vue.directive('has', {
	bind: function(el, binding) {
		// console.log(el, binding)
		// console.log(Vue.prototype.$_has(binding.value))
		if (!Vue.prototype.$_has(binding.value)) {
			el.style.display = 'none'
		}
	}
});
//权限检查方法
Vue.prototype.$_has = function(value) {
	// debugger
	let isExist = false;
	let buttonpermsStr = sessionStorage.getItem("buttonJurisdiction");
	if (buttonpermsStr == undefined || buttonpermsStr == null) {
		return false;
	}
	let buttonperms = buttonpermsStr.split(',');
	if (buttonperms.includes(value)) {
		isExist = true;
	} else{
		isExist = false;
	}
	return isExist;
};